package com.jame.design_mode.singleton;

/**
 * @author : Jame
 * @date : 2021-01-03 18:14
 * 静态内部类
 **/
public class InnerClassSingleton {

    public static class InnerClass {
        private static InnerClass innerClass = new InnerClass();

        private InnerClass() {
            if (InnerClass.innerClass != null) {
                throw new RuntimeException("已经存在一个实例!");
            }
        }

        public static InnerClass getInnerClass() {
            return innerClass;

        }
    }
}
